<?php

namespace App\Http\Controllers\Logic;

use App\Http\Controllers\Controller;
use App\Model\OALimit;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;

class LimitLogic extends Controller
{
    public function getList()
    {
        return OALimit::query()->select(["*"])->get()->toArray();
    }

    public function editLimit($input)
    {
        try{
            DB::beginTransaction();
            $limit = OALimit::query()->where('id',$input['id'])->first();
            $limit->limit_money = $input['limit_money'];
            $limit->save();
            DB::commit();
            return true;
        }catch (\Exception $e){
            DB::rollBack();
            throw new \Exception($e->getMessage());
        }
    }
}

